﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace StarlightUI
{
    public partial class InvisibleFlow : FlowLayoutPanel
    {
        [System.ComponentModel.Browsable(true),
System.ComponentModel.Category("Presentation"),
System.ComponentModel.Description("Visual Tag for the panel.")]
        public string Text
        {
            get
            {
                return mText;
            }
            set
            {
                mText = value;
            }
        }
        private string mText = null;
        [System.ComponentModel.Browsable(true),
System.ComponentModel.Category("Presentation"),
System.ComponentModel.Description("The Top most color of the gradient.")]
        public Color TopColor
        {
            get
            {
                return mTop;
            }
            set
            {
                mTop = value;
            }
        }
        private Color mTop = Color.Aqua;


        [System.ComponentModel.Browsable(true),
System.ComponentModel.Category("Presentation"),
System.ComponentModel.Description("The Bottom most color of the gradient.")]
        public Color BottomColor
        {
            get
            {
                return mBot;
            }
            set
            {
                mBot = value;
            }
        }
        private Color mBot = Color.DarkBlue;
        public InvisibleFlow() : base()
        {
            InitializeComponent();
        }
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);
            Graphics graphics = e.Graphics;

            int penWidth = 4;
            Pen pen = new Pen(Color.Black, 4);

            int fontHeight = 10;
            Font font = new Font("Arial", fontHeight);

            for (int y = 0; y < Height; y++)
            {
                float af = (float)y / (float)Height;
                pen.Color = Help.BlendColor(TopColor, BottomColor, af);
                graphics.DrawLine(pen, new Point(0, y), new Point(Width, y));

            }
            Brush bs = new SolidBrush(Color.Black);
            graphics.DrawString(Text, font, bs, new PointF(5, 5));
        }
    }
}
